﻿using System;
using System.Collections.Generic;
using System.Text;
using Pahan.McuFusion.IO.Windows;

namespace Pahan.McuFusion.IO
{
    internal static class ParallelPortImplFactory
    {
        public static IParallelPortImpl Create()
        {
            switch (Environment.OSVersion.Platform)
            {
                case PlatformID.MacOSX:
                    return CreateMacOSXImpl();
                case PlatformID.Unix:
                    return CreateUnixImpl();
                case PlatformID.Win32NT:
                case PlatformID.Win32Windows:
                    return CreateWindowsImpl();
                case PlatformID.Win32S:
                case PlatformID.WinCE:
                case PlatformID.Xbox:
                default:
                    throw new NotSupportedException("The operating system is not supported.");
            }
        }

        private static IParallelPortImpl CreateWindowsImpl()
        {
            return new WinRing0ParallelPortImpl();
        }

        private static IParallelPortImpl CreateUnixImpl()
        {
            /* Note: Different implementations will be needed for different UNIXes.*/
            throw new NotSupportedException("The operating system is not supported.");
        }

        private static IParallelPortImpl CreateMacOSXImpl()
        {
            /* 
             * Note: Does Mac OS X supports parallel ports out-of-box?
             * Kext may be needed to implement the required functionality.
            */
            throw new NotSupportedException("The operating system is not supported.");
        }
    }
}
